import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_framework/theme/theme_item.dart';
import 'package:flutter_framework/theme/themes.dart';
import 'package:flutter_framework/utils/logs.dart';
import 'package:get/get.dart';

class ThemeCtrl extends GetxController {
  static ThemeCtrl get to => Get.find<ThemeCtrl>();
  ThemeItem themeItem = Themes.lignt;

  changeTheme(ThemeEnum theme){
    switch (theme){
      case ThemeEnum.dark:
        Get.changeTheme(Themes.dark.themeData);
        Get.changeThemeMode(Themes.dark.themeMode);
        themeItem = Themes.dark;
        // SystemChrome.setSystemUIOverlayStyle(  SystemUiOverlayStyle.dark);      // 黑色
        logs('深色主题设置 ====');
        update();
        break;

      case ThemeEnum.light:
        Get.changeTheme(Themes.lignt.themeData);
        Get.changeThemeMode(Themes.lignt.themeMode);
        themeItem = Themes.lignt;
        // SystemChrome.setSystemUIOverlayStyle(  SystemUiOverlayStyle.light);      // 白色
        logs('浅色主题设置 ====');

        update();
        break;
      default:
        Get.changeTheme(Themes.lignt.themeData);
        Get.changeThemeMode(Themes.lignt.themeMode);
        themeItem = Themes.lignt;
        SystemChrome.setSystemUIOverlayStyle(  SystemUiOverlayStyle.light);      // 白色
        update();
        break;
    }
  }

}
